$(function(){
    //页面加载完就执行
	//商品展示效果
	$(".allImgs .smallImg").mouseover(function(){
		$(this).addClass("smallImgHover").siblings().removeClass("smallImgHover");
		var smallImgSrc=$(this).children().attr("src");
		$(this).parent().siblings().children().attr("src",smallImgSrc);
	});
	
	//留言、介绍效果
	$(".commodityInfo .commodityMessage div a").click(function(){
		$(this).addClass("intro");
		var $targetA=$(this).parent().siblings().children();
		$targetA.removeClass("intro");
		var $targetIndex=$(this).parent().index();
		showTarget($targetIndex);
	});
	
	$("#commQuality").html(getQuality(commQuality));
});
function getQuality(str){
	switch (str) {
	case "100":
		return "全新";
		break;
	case "95":
		return "九五新";
		break;
	case "90":
		return "九成新";
		break;
	case "85":
		return "八五新";
		break;
	case "80":
		return "八成新";
		break;
	case "70":
		return "七成新";
		break;
	case "60":
		return "六成新";
		break;
	case "50":
		return "五成新";
		break;
	}
}

function showTarget(num){
	var $megDetail=$(".commodityInfo .commodityMessageDetail");
	if(num+1){
		$megDetail.children("div").eq(num).show().siblings().hide();
	}	
}